Failure

data class Failure(exception: Throwable) : Try<Nothing>

Functions

filter
Link copied to clipboard
common
open override fun filter(predicate: (Nothing) -> Boolean): Try<Nothing>
Returns the same Success if the predicate is satisfied for the value.
filterIsInstance
Link copied to clipboard
common
inline fun <R> filterIsInstance(): Try<R>
Returns the same Success casted to type R if it is R.
filterNot
Link copied to clipboard
common
open override fun filterNot(predicate: (Nothing) -> Boolean): Try<Nothing>
Returns the same Success if the predicate is not satisfied for the value.
filterOrElse
Link copied to clipboard
common
open override fun filterOrElse(predicate: (Nothing) -> Boolean, throwable: (Nothing) -> Throwable): Try<Nothing>
Returns the same Success if the predicate is satisfied for the value.
flatMap
Link copied to clipboard
common
open override fun <R> flatMap(transform: (Nothing) -> Try<R>): Try<R>
Maps value of a Success to a new Try using transform or returns the same Try if this is a Failure.
fold
Link copied to clipboard
common
inline fun <R> fold(successTransform: (Nothing) -> R, failureTransform: (Throwable) -> R): R
Transforms a Success using successTransform or a Failure using failureTransform.
forEach
Link copied to clipboard
common
open override fun forEach(action: (Nothing) -> Unit)
Runs action if this is a Success.
get
Link copied to clipboard
common
open override fun get(): Nothing
Gets the value of a Success or throw an exception from a Failure.
getOrNull
Link copied to clipboard
common
open override fun getOrNull(): Nothing?
Gets the value of a Success or null if this is a Failure.
map
Link copied to clipboard
common
open override fun <R> map(transform: (Nothing) -> R): Try<R>
Maps value of a Success using transform or returns the same Try if this is a Failure.
toEither
Link copied to clipboard
common
open override fun toEither(): Either<Throwable, Nothing>
Converts this Try to Either.
toOption
Link copied to clipboard
common
open override fun toOption(): Option<Nothing>
Converts this Try to Option.
transform
Link copied to clipboard
common
inline fun <R> transform(successTransform: (Nothing) -> Try<R>, failureTransform: (Throwable) -> Try<R>): Try<R>
Transforms a Success using successTransform or a Failure using failureTransform.
zip
Link copied to clipboard
common
infix fun <R> zip(other: Try<R>): Try<Pair<Nothing, R>>
Returns Success containing a Pair of values of this and other if both instances of Try are Success.
inline fun <T1, R> zip(other: Try<T1>, transform: (Nothing, T1) -> R): Try<R>
Returns Success containing the result of applying transform to both values of this and other if both instances of Try are Success.

Properties

exception
Link copied to clipboard
common
val exception: Throwable
failed
Link copied to clipboard
common
open override val failed: Try<Throwable>
Returns a Success with an exception it this is a Failure or a Failure if this is a Success.
isFailure
Link copied to clipboard
common
open override val isFailure: Boolean
Returns true if this is a Failure or false if this is Success.
isSuccess
Link copied to clipboard
common
open override val isSuccess: Boolean
Returns true if this is a Success or false if this is Failure.